using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.Runtime.InteropServices;
using System.Resources;
using System.Globalization;


namespace LPV_POS.mh_pos
{
    public partial class mh_thongbao : DevExpress.XtraEditors.XtraForm
    {
        CultureInfo culture;
        #region "Muti language"

        private void SetLanguage_banhang(string cultureName)
        {//this.DialogResult
            try
            {
                culture = CultureInfo.CreateSpecificCulture(cultureName);
                ResourceManager rm = new ResourceManager("LPV_POS.Muti_language.MyResource", typeof(mh_thongbao).Assembly);
                bton_co.Text = rm.GetString("dongy", culture);
                bton_dongy.Text = rm.GetString("dongy", culture);
                bton_khong.Text = rm.GetString("thoat", culture);
                //this.Text = rm.GetString("thongbao_1", culture);
                //this.DialogResult = DialogResult.None;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Note");
            }

        }

        #endregion
        public mh_thongbao()
        {
            InitializeComponent();
            culture = CultureInfo.CurrentCulture;
           // this.menuManager = new SystemMenuManager(this, SystemMenuManager.MenuItemState.Removed);
         
        }
        
        public mh_thongbao(string content, int _loaithongbao)
        {
            InitializeComponent();
            // this.Text = (_so == so.baoloi)+"";
            string path_file = "";
            this.lbel_thongbao.Text = content;
            if (_loaithongbao == 1)
            {
                path_file = Application.StartupPath + "\\icon_message\\message_error_1.jpg";
                bton_co.Visible = false;
                bton_khong.Visible = false;
                bton_dongy.Visible = true;
            }
            else if (_loaithongbao == 2)
            {
                path_file = Application.StartupPath + "\\icon_message\\message_warn.jpg";
                bton_co.Visible = false;
                bton_khong.Visible = false;
                bton_dongy.Visible = true;
            }

            else if (_loaithongbao == 3)
            {
                path_file = Application.StartupPath + "\\icon_message\\message_question_1.jpg";
                bton_co.Visible = true;
                bton_khong.Visible = true;
                bton_dongy.Visible = false;
            }
            else if (_loaithongbao == 4)
            {
                path_file = Application.StartupPath + "\\icon_message\\messsage_info.jpg";
                bton_co.Visible = false;
                bton_khong.Visible = false;
                bton_dongy.Visible = true;
            }
            Image img_question = Image.FromFile(path_file);
            lbel_hinh.Image = img_question;
        }


        public mh_thongbao(string content, int _loaithongbao, string strText_btnCo, string strText_btnKhong)
        {
            InitializeComponent();
            // this.Text = (_so == so.baoloi)+"";
            string path_file = "";
            this.lbel_thongbao.Text = content;
            if (_loaithongbao == 1)
            {
                path_file = Application.StartupPath + "\\icon_message\\message_error_1.jpg";
                bton_co.Visible = false;
                bton_khong.Visible = false;
                bton_dongy.Visible = true;
            }
            else if (_loaithongbao == 2)
            {
                path_file = Application.StartupPath + "\\icon_message\\message_warn.jpg";
                bton_co.Visible = false;
                bton_khong.Visible = false;
                bton_dongy.Visible = true;
            }

            else if (_loaithongbao == 3)
            {
                path_file = Application.StartupPath + "\\icon_message\\message_question_1.jpg";
                bton_co.Visible = true;
                bton_khong.Visible = true;
                bton_dongy.Visible = false;
            }
            else if (_loaithongbao == 4)
            {
                path_file = Application.StartupPath + "\\icon_message\\messsage_info.jpg";
                bton_co.Visible = false;
                bton_khong.Visible = false;
                bton_dongy.Visible = true;
            }
            Image img_question = Image.FromFile(path_file);
            lbel_hinh.Image = img_question;
            //
            bton_co.Text = strText_btnCo;
            bton_khong.Text = strText_btnKhong;
        }

        DialogResult dlg = DialogResult.None;

        private void mh_thongbao_Load(object sender, EventArgs e)
        {
            cpublic ocpublic = new cpublic();
            string str_lang = ocpublic.Registry_Get("mh_main_lang");
            if (str_lang == "")
                str_lang = "vi-VN";
            SetLanguage_banhang(str_lang);
            //string path_file = Application.StartupPath;
            //MessageBox.Show("fdsfds","fdsfd",
            //path_file = "fdsfdsa";
        }

        private void bton_dongy_Click(object sender, EventArgs e)
        {
            this.dlg = DialogResult.OK;
            this.Close();
        }

        private void bton_co_Click(object sender, EventArgs e)
        {
            Variable.thongbao = true;
            this.dlg = DialogResult.OK;
            this.Close();
        }

        private void bton_khong_Click(object sender, EventArgs e)
        {
            Variable.thongbao = false;
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        public DialogResult ShowForm() 
        {
            try
            {
                this.DialogResult = DialogResult.None;
                this.ShowDialog();
            }
            catch (Exception ex)
            {
                string ss = ex.Message;
            }
            return this.dlg;
        }
    }



}
